package com.woniuxy.usercoachassemble.controller;


import com.woniuxy.usercoachassemble.entity.Comment;
import com.woniuxy.usercoachassemble.service.CommentService;
import org.example.Result;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.time.LocalDateTime;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Lucas
 * @since 2020-07-16
 */
@RestController
@RequestMapping("comment")
public class CommentController {

    @Autowired

    private CommentService commentServiceImpl;
    @RequestMapping("addcomment")
    public Result addcomment(int ordersId, String comentcontent,int commentlevel){
        Comment comment = new Comment();
        comment.setCommentTime(LocalDateTime.now());
        comment.setOrdersId(ordersId);
        comment.setLevel(commentlevel);
        commentServiceImpl.save(comment);
        return  Result.Success();
    }

}

